package com.jchen.auth.controller;

import com.jchen.auth.service.LoginService;
import com.jchen.common.entity.UserInfo;
import com.jchen.common.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description security+jwt
 * @Author jchen
 * @Date 2023/12/11 17:24
 */
@Api(value = "验证码管理",tags = "验证码管理")
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/user/login")
    @ApiOperation("登录")
    public R login(@RequestBody UserInfo user){
        return loginService.login(user);
    }

    @PostMapping("/user/logout")
    @ApiOperation("登出")
    public R logout(){
        return loginService.logout();
    }

    @GetMapping("/user/selectUserById")
    @ApiOperation("测试jwt")
    public R login(Integer id){
        return loginService.selectUserById(id);
    }
}
